#!/bin/bash
# Author: yanjingtu <yanjingtu2008@yeah.net>
# Date: 2020/7/24
# Url: https://gitee.com/yanjingtu/centos-dockerfiles/tree/master/scripts/

# ENV
NODE_VERSION=v14.6.0

# 安装nodejs
curl -L https://npm.taobao.org/mirrors/node/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.xz | tar -C /usr/local -xJ
ln -s /usr/local/node-$NODE_VERSION-linux-x64/bin/node /usr/bin/node
ln -s /usr/local/node-$NODE_VERSION-linux-x64/bin/npm /usr/bin/npm

# 安装cnpm扩展，自动使用taobao镜像
npm set registry https://registry.npm.taobao.org
npm set disturl https://npm.taobao.org/dist
npm cache clean --force
npm install -g cnpm --registry=https://registry.npm.taobao.org
ln -s /usr/local/node-$NODE_VERSION-linux-x64/lib/node_modules/cnpm/bin/cnpm /usr/bin/cnpm
